/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package shopnav;

import javax.jws.WebService;
import javax.jws.WebMethod;

/**
 *
 * @author amiddrisu
 */
@WebService
public class shopnav_ws {

     //declare the database class....
    clsDatabase clsDB=null;

    //add new Mall
    @WebMethod
    public int addMall(Mall ml)
    {
        int rs=0;
        clsDB=new clsDatabase();
        rs=clsDB.addMall(ml);
        return rs;
    }
    //add new shop
    @WebMethod
    public int addShop(Shop sh)
    {
        int rs=0;
        clsDB=new clsDatabase();
        rs=clsDB.addShop(sh);
        return rs;
    }
    //add new product
    @WebMethod
    public int addProduct(Product prdt)
    {
        int rs=0;
        clsDB=new clsDatabase();
        rs=clsDB.addProduct(prdt);
        return rs;
    }
    //get all malls
    @WebMethod
    public Mall[] getMalls()
    {
        Mall [] arrMall=null;
        clsDB=new clsDatabase();
        arrMall=clsDB.getMalls();
        return arrMall;
    }
    //get all shops per mall
    @WebMethod
    public Shop[] getShops(String mallId)
    {
        Shop [] arrShop=null;
        clsDB=new clsDatabase();
        arrShop=clsDB.getShops(mallId);
        return arrShop;
    }
    //get all shops in the system
    @WebMethod
    public Shop[] getAllShops()
    {
        Shop[] arrShops=null;
        clsDB=new clsDatabase();
        arrShops=clsDB.getAllShops();
        return arrShops;
    }
    //get all products per shop
    @WebMethod
    public Product[] getProducts(int shopId)
    {
        Product [] arrPrd=null;
        clsDB=new clsDatabase();
        arrPrd=clsDB.getProducts(shopId);
        return arrPrd;
    }
    //get all products....
    @WebMethod
    public Product[] getAllProducts()
    {
        Product [] arrPrd=null;
        clsDB=new clsDatabase();
        arrPrd=clsDB.getAllProducts();
        return arrPrd;
    }
    //get products per category
    @WebMethod
    public Product[] getProductsByCat(String cat)
    {
        Product [] arrPrd=null;
        clsDB=new clsDatabase();
        arrPrd=clsDB.getProductsByCat(cat);
        return arrPrd;
    }
    //get products by category and shop
    @WebMethod
    public Product[] getProductsByCatShop(String cat,int shopId)
    {
        Product [] arrPrd=null;
        clsDB=new clsDatabase();
        arrPrd=clsDB.getProductsByCatShop(cat, shopId);
        return arrPrd;
    }
    //get shops by category
    @WebMethod
    public Shop[] getShopsByCat(String cat)
    {
        Shop [] arrShop=null;
        clsDB=new clsDatabase();
        arrShop=clsDB.getShopsByCat(cat);
        return arrShop;
    }
    //get shop by category and mall
    @WebMethod
    public Shop[] getShopsByCatMall(String cat,int mallId)
    {
        Shop [] arrShop=null;
        clsDB=new clsDatabase();
        arrShop=clsDB.getShopsByCatMall(cat, mallId);
        return arrShop;
    }
    //add shoppers history
    @WebMethod
    public int addShopperHistory()
    {
        int rs=0;
        return rs;
    }
    //get shoppers history
    @WebMethod
    public void getShopperHistory(String userid)
    {

    }
    //get user details....
    @WebMethod
    public User loginUser(String userId,String passwd)
    {
        User usr=null;
        clsDB=new clsDatabase();
        usr=clsDB.loginUser(userId, passwd);
        return usr;
    }
   //saves user details...
    @WebMethod
    public int saveUser(User usr)
    {

        clsDB=new clsDatabase();
        int rs=clsDB.saveUser(usr);
        return rs;
    }
}
